# coding=utf-8
'''
@Descripttion: 
@version: 
@Author: JackZhang
@Date: 2020-03-30 15:26:31
@LastEditors: JackZhang
@LastEditTime: 2020-03-30 19:21:58
'''
import os
import sys
import pygame
from pygame.locals import *
from local import *

path = os.path.dirname(os.path.abspath(sys.argv[0]))
path = path.replace('\\','/')
print(path)

pygame.init()
pygame.display.set_caption("Hello world")
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
mFont = pygame.font.Font(path + "/fonts/pixel.ttf",12)
text = mFont.render("Hello, world! 你好，世界！", 1, Color("white"))
screen.blit(text,(0,0))
text = mFont.render("This is a test about pixel-font. 这是像素字体测试。", 1, Color("white"))
screen.blit(text,(0,12))
text = mFont.render("PyGame is more effective than SDL2.", 1, Color("white"))
screen.blit(text,(0,24))
text = mFont.render("Let's see what a pixel-picture looks like in PyGame:", 1, Color("white"))
screen.blit(text,(0,36))
img = pygame.image.load(path + "/res/test/bootLogo.png")
screen.blit(img,(0,56))
text = mFont.render("Fantastic, that's perfect for pixel-art.", 1, Color("white"))
screen.blit(text,(0,128))
text = mFont.render("Press ESC or click the close button to exit PyGame.", 1, Color("white"))
screen.blit(text,(0,140))
text = mFont.render("Lazy_V.", 1, Color("white"))
screen.blit(text,(260,220))
pygame.display.update()

while(True):
    for event in pygame.event.get():
        if(event.type == pygame.QUIT):
            pygame.quit()
            sys.exit()
        elif(event.type == pygame.KEYDOWN):
            if(event.key == pygame.K_ESCAPE):
                pygame.quit()
                sys.exit()